package com.chenxin.wms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chenxin.wms.domain.AgvTaskEntity;
import com.chenxin.wms.mapper.AgvTaskMapper;
import com.chenxin.wms.service.IAgvTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AgvTaskServiceImpl implements IAgvTaskService {
    @Autowired
    private AgvTaskMapper agvTaskMapper;

    @Override
    public AgvTaskEntity selectAgvTaskOne() {
        // 获取待下发任务（根据条件进行排序，如入库优先等）
        QueryWrapper<AgvTaskEntity> taskQW = new QueryWrapper<>();
        taskQW.lambda().eq(AgvTaskEntity::getAgvStatus, 0)
                .orderByAsc(AgvTaskEntity::getCreateDate).last("limit 1");
        return agvTaskMapper.selectOne(taskQW);
    }
}
